package cn.edu.zzuli.common.utils;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class AccessToken {

    public static String getAccessToken(){
        String res = HttpUtil.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx9f24b5b35a6d2ce8&secret=cf3a6b91479f0a90391d846bd1694076");
        // 解析相应内容（转换成json对象）
        JSONObject jsonObject = JSON.parseObject(res);
        //System.out.println(jsonObject);
        //拿到accesstoken
        String accessToken = (String) jsonObject.get("access_token");
        //System.out.println("accessToken: " +  accessToken);
        return accessToken;
    }
}
